<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:75:"D:\phpStudy\WWW\oa\public/../application/admin\view\myself\myselfapply.html";i:1515491027;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-pencil-square-o"></span>我的审批</strong>&emsp;<a
            style="color: #3a4bfb;font-weight: bold " href="javascript:history.go(-1)">返回上一步</a></div>
    <div class="layui-tab layui-tab-card" style="width: 1100px;margin-top: auto;">
        <ul class="layui-tab-title">
            <li class="layui-this">费用报销审批<?php if($myselfapply_expense_reimbursement['num'] == 0): else: ?><span class="layui-badge"><?php echo $myselfapply_expense_reimbursement['num']; ?></span><?php endif; ?></li>
            <li>付款审批<?php if($myselfapply_payment_application_form['num'] == 0): else: ?><span class="layui-badge"><?php echo $myselfapply_payment_application_form['num']; ?></span><?php endif; ?></li>
            <li>考勤签到审批</li>
            <li>请假审批<?php if($myselfapply_leaves_form['num'] == 0): else: ?><span class="layui-badge"><?php echo $myselfapply_leaves_form['num']; ?></span><?php endif; ?></li>
            <li>福利审批</li>
            <li>出差审批</li>
            <li>接待费用审批</li>
            <li>合同审批<?php if($myselfapply_contract_form['num'] == 0): else: ?><span class="layui-badge"><?php echo $myselfapply_contract_form['num']; ?></span><?php endif; ?></li>
        </ul>
        <div class="layui-tab-content" style="height: 500px;">
            <div class="layui-tab-item layui-show">
                <form action="<?php echo url('Myself/myselfapply'); ?>" method="post" class="layui-form">
                    <div class="layui-inline">
                        <label class="layui-form-lable">
                            搜索：
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" placeholder="输入要搜索的单号" name="expense_reimbursement_serach" >
                            <input type="hidden" value="1" name="bill_type_id">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div style="float: right;margin-top: 2%;margin-right: 10%" class="layui-input-block">
                            <button class="layui-btn" name="submit" lay-submit="" lay-filter="expense_reimbursement_demo">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
                <table id="apply_expense_reimbursement" lay-filter="apply_expense_reimbursement">
                    <thead>
                    <tr>
                        <th lay-data="{field: 'id', title: 'ID', width: 160, align: 'center', sort: true}">昵称</th>
                        <th lay-data="{field: 'type_approve', align: 'center', title: '单据类型', sort: true}">加入时间</th>
                        <th lay-data="{field: 'reimbursement_time', align: 'center', title: '申请时间', sort: true}">加入时间</th>
                        <th lay-data="{field: 'total', align: 'center', title: '申请金额', sort: true}">加入时间</th>
                        <th lay-data="{field: 'apply_state', align: 'center', title: '审批状态', sort: true}">加入时间</th>
                        <th lay-data="{fixed: 'right', title: '操作', align: 'center', toolbar: '#barDemo'}">签名</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php if(is_array($myselfapply_expense_reimbursement['expense_reimbursement']) || $myselfapply_expense_reimbursement['expense_reimbursement'] instanceof \think\Collection || $myselfapply_expense_reimbursement['expense_reimbursement'] instanceof \think\Paginator): $i = 0; $__LIST__ = $myselfapply_expense_reimbursement['expense_reimbursement'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$expense_reimbursement): $mod = ($i % 2 );++$i;?>
                    <tr>
                        <td><?php echo $expense_reimbursement['id']; ?></td>
                        <td><?php echo $expense_reimbursement['type_approve']; ?></td>
                        <td><?php echo $expense_reimbursement['reimbursement_time']; ?></td>
                        <td><?php echo $expense_reimbursement['total']; ?></td>
                        <td><?php echo $expense_reimbursement['apply_state']; ?></td>
                    </tr>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                    </tbody>
                </table>
            </div>
            <div class="layui-tab-item">
                <form class="layui-form" method="post" action="<?php echo url('Myself/myselfapply'); ?>">
                    <div class="layui-inline">
                        <label class="layui-form-lable">
                            搜索：
                        </label>
                        <div class="layui-input-inline">
                            <input type="hidden" value="2" name="bill_type_id">
                            <input type="text" class="layui-input" placeholder="输入要搜索的单号" name="payment_application_form_search">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div style="float: right;margin-top: 2%;margin-right: 10%" class="layui-input-block">
                            <button name="submit" class="layui-btn" lay-submit="" lay-filter="payment_application_form_demo">立即搜索</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
                <table id="apply_payment_application_form" lay-filter="apply_payment_application_form">
                    <thead>
                    <tr>
                        <th lay-data="{field: 'id', title: 'ID', width: 160, align: 'center', sort: true}">昵称</th>
                        <th lay-data="{field: 'type_approve', align: 'center', title: '单据类型', sort: true}">加入时间</th>
                        <th lay-data="{field: 'payee', align: 'center', title: '收款单位', sort: true}">加入时间</th>
                        <th lay-data="{field: 'payment_application_form_time', align: 'center', title: '申请时间', sort: true}">加入时间</th>
                        <th lay-data="{field: 'amount_payment', align: 'center', title: '付款金额', sort: true}">加入时间</th>
                        <th lay-data="{field: 'apply_state', align: 'left', title: '审批状态', sort: true}">签名</th>
                        <th lay-data="{fixed: 'right', title: '操作', align: 'center', toolbar: '#barDemo'}">签名</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php if(is_array($myselfapply_payment_application_form['myselfapply_payment_application_form']) || $myselfapply_payment_application_form['myselfapply_payment_application_form'] instanceof \think\Collection || $myselfapply_payment_application_form['myselfapply_payment_application_form'] instanceof \think\Paginator): $i = 0; $__LIST__ = $myselfapply_payment_application_form['myselfapply_payment_application_form'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$payment_application_form): $mod = ($i % 2 );++$i;?>
                    <tr>
                        <td><?php echo $payment_application_form['id']; ?></td>
                        <td><?php echo $payment_application_form['type_approve']; ?></td>
                        <td><?php echo $payment_application_form['payee']; ?></td>
                        <td><?php echo $payment_application_form['payment_application_form_time']; ?></td>
                        <td><?php echo $payment_application_form['amount_payment']; ?></td>
                        <td><?php echo $payment_application_form['apply_state']; ?></td>
                    </tr>
                    <?php endforeach; endif; else: echo "" ;endif; ?>


                    </tbody>
                </table>
            </div>
            <div class="layui-tab-item">暂未开通此功能</div>
            <div class="layui-tab-item">
                <form action="<?php echo url('Myself/myselfapply'); ?>" method="post" class="layui-form">
                    <div class="layui-inline">
                        <label class="layui-form-lable">
                            搜索：
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" placeholder="输入要搜索的单号" name="leaves_form_serach" >
                            <input type="hidden" value="4" name="bill_type_id">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div style="float: right;margin-top: 2%;margin-right: 10%" class="layui-input-block">
                            <button class="layui-btn" name="submit" lay-submit="" lay-filter="leaves_form_demo">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
                <table id="apply_leaves_form" lay-filter="apply_leaves_form">
                    <thead>
                    <tr>
                        <th lay-data="{field: 'id', title: 'ID', width: 160, align: 'center', sort: true}">昵称</th>
                        <th lay-data="{field: 'type_approve', align: 'center', title: '单据类型', sort: true}">加入时间</th>
                        <th lay-data="{field: 'type_leave', align: 'center', title: '请假类型', sort: true}">加入时间</th>
                        <th lay-data="{field: 'leave_form_time', align: 'center', title: '申请时间', sort: true}">加入时间</th>
                        <th lay-data="{field: 'apply_state', align: 'center', title: '审批状态', sort: true}">加入时间</th>
                        <th lay-data="{fixed: 'right', title: '操作', align: 'center', toolbar: '#barDemo'}">签名</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php if(is_array($myselfapply_leaves_form['leaves_form']) || $myselfapply_leaves_form['leaves_form'] instanceof \think\Collection || $myselfapply_leaves_form['leaves_form'] instanceof \think\Paginator): $i = 0; $__LIST__ = $myselfapply_leaves_form['leaves_form'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$leaves_form): $mod = ($i % 2 );++$i;?>
                    <tr>
                        <td><?php echo $leaves_form['id']; ?></td>
                        <td><?php echo $leaves_form['type_approve']; ?></td>
                        <td><?php echo $leaves_form['type_leave']; ?></td>
                        <td><?php echo $leaves_form['leave_form_time']; ?></td>
                        <td><?php echo $leaves_form['apply_state']; ?></td>
                    </tr>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                    </tbody>
                </table>
            </div>
            <div class="layui-tab-item">暂未开通此功能</div>
            <div class="layui-tab-item">暂未开通此功能</div>
            <div class="layui-tab-item">暂未开通此功能</div>
            <div class="layui-tab-item">
                    <form action="<?php echo url('Myself/myselfapply'); ?>" method="post" class="layui-form">
                        <div class="layui-inline">
                            <label class="layui-form-lable">
                                搜索：
                            </label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" placeholder="输入要搜索的单号" name="contract_form_search" >
                                <input type="hidden" value="8" name="bill_type_id">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div style="float: right;margin-top: 2%;margin-right: 10%" class="layui-input-block">
                                <button class="layui-btn" name="submit" lay-submit="" lay-filter="leaves_form_demo">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                    <table id="apply_contract_form" lay-filter="apply_contract_form">
                        <thead>
                        <tr>
                            <th lay-data="{field: 'id', title: '编号', width: 85, align: 'center', sort: true}">昵称</th>
                            <th lay-data="{field: 'sub_region', width: 215, align: 'center', title: '提交区域', sort: true}">加入时间</th>
                            <th lay-data="{field: 'contract_type', width: 145, align: 'center', title: '合同类型', sort: true}">加入时间</th>
                            <th lay-data="{field: 'contract_approve_time', width: 140, align: 'center', title: '合同申请时间', sort: true}">加入时间</th>
                            <th lay-data="{field: 'contract_name', width: 112, align: 'center', title: '合同名称', sort: true}">加入时间</th>
                            <th lay-data="{field: 'contract_code',  width: 120,align: 'center', title: '合同编号', sort: true}">加入时间</th>
                            <th lay-data="{field: 'apply_state', width: 125, align: 'center', title: '审批状态', sort: true}">加入时间</th>
                            <th lay-data="{ title: '操作', align: 'center', toolbar: '#barDemo'}">签名</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php if(is_array($myselfapply_contract_form['contract_form']) || $myselfapply_contract_form['contract_form'] instanceof \think\Collection || $myselfapply_contract_form['contract_form'] instanceof \think\Paginator): $i = 0; $__LIST__ = $myselfapply_contract_form['contract_form'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$contract_form): $mod = ($i % 2 );++$i;?>
                        <tr>
                            <td><?php echo $contract_form['id']; ?></td>
                            <td><?php echo $contract_form['sub_region']; ?></td>
                            <td><?php echo $contract_form['contract_type']; ?></td>
                            <td><?php echo $contract_form['contract_approve_time']; ?></td>
                            <td><?php echo $contract_form['contract_name']; ?></td>
                            <td><?php echo $contract_form['contract_code']; ?></td>
                            <td><?php echo $contract_form['apply_state']; ?></td>
                        </tr>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                </div>
        </div>
    </div>

</div>
</body>
<script type="text/javascript" src="__JS__/showdate.js"></script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">查看详情</a>
</script>
<script>
    layui.use('element', function(){
        var $ = layui.jquery
            ,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function(){
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项'+ (Math.random()*1000|0) //用于演示
                    ,content: '内容'+ (Math.random()*1000|0)
                    ,id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }

        };

        $('.site-demo-active').on('click', function(){
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function(elem){
            location.hash = 'test='+ $(this).attr('lay-id');
        });

    });
</script>
<script>
    layui.use(['table', 'laydate'], function () {
        var table = layui.table
            , laydate = layui.laydate;
        laydate.render({
            elem: '#reimbursement_time'
        });
        /*--------------------------------------------------*/
        //监听工具条 付款审批
        table.on('tool(apply_payment_application_form)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                window.location.replace("<?php echo url('Myself/myselfapply_payment_application_form_save'); ?>?id=" + data.id)
                //layer.alert('编辑行：<br>' + JSON.stringify(data))
            } else if (obj.event === 'del') {
                //console.log(data.id);
                dels(data.id);
                //layer.close(admin);
            }
        });
        table.init('apply_payment_application_form', {
            height: 400 //设置高度
            ,initSort: {
                //排序字段，对应 cols 设定的各字段名
                field: 'id'
                //排序方式  asc: 升序、desc: 降序、null: 默认排序
                ,type: 'desc'
            }
            , page: {
                layout: ['count', 'limit', 'prev', 'page', 'next', 'skip']
                , curr: 1
            }
            //,limit: 10 //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致
            //支持所有基础参数
        });
        /*--------------------------------------------------*/
        //监听工具条  费用审批
        table.on('tool(apply_expense_reimbursement)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                window.location.replace("<?php echo url('Myself/myselfapply_expense_reimbursement_save'); ?>?id=" + data.id)
                //layer.alert('编辑行：<br>' + JSON.stringify(data))
            } else if (obj.event === 'del') {
                dels(data.id);
            }
        });
        //方法渲染table
        table.init('apply_expense_reimbursement',{
             height: 400
            ,initSort: {
                //排序字段，对应 cols 设定的各字段名
                field: 'id'
                //排序方式  asc: 升序、desc: 降序、null: 默认排序
                ,type: 'desc'
            }
            , page: {
                layout: ['count', 'limit', 'prev', 'page', 'next', 'skip']
                , curr: 1
            }
        });
        /*--------------------------------------------------*/
        //监听工具条   请假审批
        table.on('tool(apply_leaves_form)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                window.location.replace("<?php echo url('Myself/myselfapply_leaves_form_save'); ?>?id=" + data.id)
                //layer.alert('编辑行：<br>' + JSON.stringify(data))
            } else if (obj.event === 'del') {
                dels(data.id);
            }
        });
        //方法渲染table
        table.init('apply_leaves_form',{
            height: 400
            ,initSort: {
                //排序字段，对应 cols 设定的各字段名
                field: 'id'
                //排序方式  asc: 升序、desc: 降序、null: 默认排序
                ,type: 'desc'
            }
            , page: {
                layout: ['count', 'limit', 'prev', 'page', 'next', 'skip']
                , curr: 1
            }
        });
        /*--------------------------------------------------*/
        //监听工具条    合同审批
        table.on('tool(apply_contract_form)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                window.location.replace("<?php echo url('Myself/myselfapply_contract_form_save'); ?>?id=" + data.id)
                //layer.alert('编辑行：<br>' + JSON.stringify(data))
            } else if (obj.event === 'del') {
                dels(data.id);
            }
        });
        //方法渲染table
        table.init('apply_contract_form',{
            height: 400
            ,initSort: {
                //排序字段，对应 cols 设定的各字段名
                field: 'id'
                //排序方式  asc: 升序、desc: 降序、null: 默认排序
                ,type: 'desc'
            }
            , page: {
                layout: ['count', 'limit', 'prev', 'page', 'next', 'skip']
                , curr: 1
            }
        });
        var $ = layui.$, active = {
            reload: function () {
                var reimbursement_time = $('#reimbursement_time');

                //执行重载
                table.reload('test', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    , where: {
                        key: {
                            reimbursement_time: reimbursement_time.val()
                        }
                    }
                });
            }
        };
        $('.demoTable .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
<script>
    function dels(id) {
        //alert(id);
        layui.use(['layer'], function () {
            var layer = layui.layer;
            layer.confirm('你确定要删除审批记录/撤销正在审批的申请吗?',{icon: 7, title: '提示'}, function (index) {
                var submit = "submit";
                $.ajax({
                    type: "post",
                    url: "<?php echo url('Myself/myselfapprovedel'); ?>",
                    data: {'id': id, 'submit': submit},
                    dataType: "json",
                    success: function (i) {
                        //console.log(i);
                        if (i == 1) {
                            layer.msg('申请记录删除成功', {icon: 1});
                            layer.close(index);
                        }
                        else if (i == 2) {
                            layer.msg('撤销申请失败', {icon: 1});
                            layer.close(index);
                        }
                        else if (i == 3) {
                            layer.msg('申请已撤销', {icon: 1});
                            layer.close(index);
                        } else {
                            layer.msg('删除申请记录失败', {icon: 2});
                            layer.close(index);
                        }

                        setTimeout(function () {
                            //使用  setTimeout（）方法设定定时2000<a href="https://www.baidu.com/s?wd=%E6%AF%AB%E7%A7%92&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWuHn4n1DkmynYmhu9uhcd0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHf4PWmsrHRdnWckPWnkrHmkrf" target="_blank" class="baidu-highlight">毫秒</a>
                            window.location.reload();//页面刷新
                        }, 2000);
                    }
                });

            });
        });
    }
</script>
</html>